home *** CD-ROM | disk | FTP | other *** search
- Path: inforamp.net!usenet
- From: daji@inforamp.net
- Newsgroups: comp.lang.rexx
- Subject: Re: How do I read from a file?
- Date: 16 Apr 1996 01:11:54 GMT
- Organization: InfoRamp Inc., Toronto, Ontario (416) 363-9100
- Distribution: inet
- Message-ID: <4kus4q$dvh@sam.inforamp.net>
- References: <4ktd9n$3qe@zipper.zip.com.au>
- Reply-To: daji@inforamp.net
- NNTP-Posting-Host: ts18-07.tor.istar.ca
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- In <4ktd9n$3qe@zipper.zip.com.au>, craig@zip.com.au (Craig Pardey) writes:
- >Hi,
- >
- >I just need to know how to open, read from and close a file in rexx. I have looked in the faq
- >and it's ot there. Is there an easy way to pull a certain line from the file, or even certain
- >elements like there is in awk?
- >
- >All help is greatly appreciated.
- >
- >cheers,
- >craig.
- >
- >--
- >| /===\/===\ | "Better get a lawyer, Son" |
- >| | OO |=============888 | "Better get a real good one." |
- >| \===/\===/ | - Cruel Sea |
- >
-
- Have you tried to use Rexx built-in functions like LineIn() LineOut()
- CharIn() and CharOut(); whcih are used to perform file I/O.
-
- To read/write to a file:
-
-
- MyFile = "C:\CONFIG.SYS"
- NewFile = "C:\CONFIG.BKP"
-
- Do While Lines(MyFile) /* Continue reading until the end-of-file */
- InLine = LineIn(Myfile) /* Reads from a file variable myfile */
- Say InLine /* Display line read on the screen */
- OutLine = LineOut(NewFile) /* Writes to a file variable NeWfile */
- End
-
- Hope this will help.
-
- Hasmukh Daji
-